using TMPro;

public class UiItemTooltip : UiTooltip
{
    private TextMeshProUGUI itemNameText;
    private TextMeshProUGUI itemTypeText;
    private TextMeshProUGUI itemDescriptionText;
    private float defaultFontSize;

    private void Awake()
    {
        itemNameText = transform.Find("ItemName").GetComponent<TextMeshProUGUI>();
        itemTypeText = transform.Find("ItemType").GetComponent<TextMeshProUGUI>();
        itemDescriptionText = transform.Find("ItemDescription").GetComponent<TextMeshProUGUI>();
        defaultFontSize = itemNameText.fontSize;
    }

    public void Show(ItemDataEquipment item)
    {
        if (item == null) return;
        itemNameText.text = item.ItemName;
        itemTypeText.text = item.equipmentType.ToString();
        itemDescriptionText.text = item.GetDescription();
        AdjustPosition();
        AdjustFontSize(itemNameText);
        gameObject.SetActive(true);
    }

    public void Hide()
    {
        gameObject.SetActive(false);
        itemNameText.fontSize = defaultFontSize;
    }
}
